import pymysql
from Read_conifg import ReadConfig

def get_mysql_data(sql):
    connnect=pymysql.Connect(
        host=ReadConfig().get_db_info("HOST"),
        port=int(ReadConfig().get_db_info("PORT")),
        user=ReadConfig().get_db_info("USER"),
        password=ReadConfig().get_db_info("PASSWORD"),
        db=ReadConfig().get_db_info("DB"),
        charset=ReadConfig().get_db_info("CHARSET")
    )
    cursor=connnect.cursor()
    sql=sql
    cursor.execute(sql)
    # connnect.commit()
    data=str(cursor.fetchall())
    str2 = ((((data.replace("(", "")).replace(")", "")).replace("Decimal", "")).replace(",", "")).replace("'", "")
    # print(str2)
    return str2
# get_mysql_data("sfryb_test","select * from khd_login where ")
